package de.slothsoft.commons.res;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

import de.slothsoft.commons.debug.Console;

public class CommonMessages {

	private static String BUNDLE_NAME = "de.slothsoft.commons.res.common"; //$NON-NLS-1$
	private static ResourceBundle bundle;

	static {
		try {
			bundle = ResourceBundle.getBundle(BUNDLE_NAME);
		} catch (MissingResourceException e) {
			// the resource bundle cannot be found
			Console.error(e.getMessage());
		}
	}

	public static String getString(String key) {
		try {
			return bundle.getString(key);
		} catch (MissingResourceException e) {
			return "!" + key + "!";//$NON-NLS-1$//$NON-NLS-2$
		}
	}

}
